#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
struct node{
	int v,y;
};
queue<node> q;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		node xx;
		scanf("%d",&xx.v);
		xx.y = i;
		q.push(xx);
	}
	while(!q.empty()){
		node t = q.front();
		q.pop();
		printf("%d ",t.y);
		for(int i=1;i<=q.size();i++){
			node r = q.front();
			q.pop();
			if(t.v==r.v){
				q.push(r);
				continue;
			}
			else if(t.v!=r.v){
				t = r;
				printf("%d ",t.y);
				
			}
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
